package com.assignwork.modules.inportship;

import com.assignwork.dto.VoyageShipInfoSubmitDTO;
import com.assignwork.service.IVoyageShipInfoService;
import com.assignwork.vo.VoyageShipInfoVO;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import io.swagger.annotations.ApiOperation;
import lombok.AllArgsConstructor;
import org.springblade.core.boot.ctrl.BladeController;
import org.springblade.core.tool.api.R;
import org.springframework.web.bind.annotation.*;

/**
 * @ClassName VoyageShipInfoController
 * @Description  船舶信息控制器
 * @Author dujianyu
 * @Date 2023/8/17 8:44
 */
@RestController
@AllArgsConstructor
@RequestMapping("voyageShipInfo")
public class VoyageShipInfoController extends BladeController {

    private IVoyageShipInfoService service;

    @GetMapping("/getDetailByVoyageId")
    @ApiOperationSupport(order = 1)
    @ApiOperation(value = "详情", notes = "传入dto")
    public R<VoyageShipInfoVO> getDetailByVoyageId(String voyageId) {
        return R.data(service.getDetailByVoyageId(voyageId));
    }

    @PostMapping("submit")
    @ApiOperationSupport(order = 2)
    @ApiOperation(value = "添加新的船舶信息", notes = "传入dto")
    public R<Boolean> submitVoyageShipInfo(@RequestBody VoyageShipInfoSubmitDTO dto) {
        return R.status(service.submitVoyageShipInfo(dto));
    }

}
